package com.lfg.leetcode.leetcode0;

/**
 * 给定一个字符串 s，找到 s 中最长的回文子串
 */
public class No7ReverseInteger {

    public static void main(String[] args) {
        System.out.println(reverse(1234554321));
//        System.out.println(convert("0123456789012345678901234567890", 4));
//        System.out.println(convert("PAYPALISHIRING", 4));
    }


    public static int reverse(int x) {
        Long ret = 0l;
        while (x != 0) {
            ret = ret * 10 + x % 10;
            x = x / 10;
        }
        if (ret > Integer.MAX_VALUE || ret < Integer.MIN_VALUE) {
            return 0;
        }
        return ret.intValue();
    }
}
